package Test;

import java.util.concurrent.CountDownLatch;

public class Demo6 {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch=new CountDownLatch(10);
        for(int i=0;i<=9;i++){
            Thread t=new Thread(()->{
                try {
                    Thread.sleep(2);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                countDownLatch.countDown();
            });
            t.start();
        }
        countDownLatch.await();
    }
}
